<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function viewEmployeeDialog(id){
		var url = "./employeeManage.do?action=viewEmployee&id="+id;
		var dlgParam = "dialogHeight:400px;dialogWidth:500px;dialogTop:300px;dialogLeft:400px;status:no;help:no;scrollbars:yes;";
		window.showModalDialog(url,"",dlgParam);
	}
	
	function updateEmployeeLevel(userId,sign){
		var deptId = "<c:out value='${deptId}'/>";
		document.employeeListForm.action = "./employeeManage.do?action=updateEmployeeLevel&id="+userId+"&deptId="+deptId+"&sign="+sign;
		document.employeeListForm.target = "employeeFrame";
		document.employeeListForm.submit();	
	}
-->
</script>
</head>
<body style="width: 100%">
<form name="employeeListForm" action="" method="post">
	<table class="table_title2">
		<tr>
			<td class="title_lab">员工管理</td>
		</tr>
		<tr><td align="right">单位：元&nbsp;&nbsp;</td></tr>
		<tr>
			<td>
				<table class="table_style">
					<tr>
						<td class="title" width="8"></td>
						<td class="title" width="15%"><fmt:message key='employee.lable.dept'/></td>
						<td class="title" width="12%"><fmt:message key='employee.lable.name'/></td>
						<td class="title" width="15%">全年指标</td>
						<td class="title" width="12%">完成金额</td>
						<td class="title" width="12%">完成比率</td>
						<td class="title" width="12%"><fmt:message key='employee.lable.result'/></td>
						<td class="title"><fmt:message key='employee.lable.level'/></td>
						<td class="title" width="12%"><fmt:message key='common.lable.operate'/></td>
					</tr>
					<%int i = 0; %>
					<c:forEach var="user" items="${users}">
					<c:if test="${user.id != userId}">
					<tr onmouseover="onmousemoveChange(this,'img${user.id}')" onmouseout="onmouseoutChange(this,'img${user.id}')">
						<td height="16" width="8" align="right"><img id="img${user.id}" src="./images/table_sign2.bmp"></td>
						<td>${user.deptName}</td>
						<td><a href="javascript:viewEmployeeDialog('${user.id}');">${user.userName}</a></td>
						<td><fmt:formatNumber value="${user.businessTarget.totalTarget}" pattern="###,###,###,###"/></td>
						<td><fmt:formatNumber value="${user.salePeriodReport.finishCost}" pattern="###,###,###,###"/></td>
						<td><fmt:formatNumber value="${user.salePeriodReport.finishRate}" pattern="###,###,###,###.##"/>%</td>
						<td>
							<c:choose>
								<c:when test="${user.isFinishedTarget == '1'}">已完成</c:when>
								<c:when test="${user.isFinishedTarget == '0'}">未完成</c:when>
							</c:choose>
						</td>
						<td title="<c:choose><c:when test='${user.creditLevel == 1}'><fmt:message key='employee.select.level1'/></c:when><c:when test='${user.creditLevel == 2}'><fmt:message key='employee.select.level2'/></c:when><c:when test='${user.creditLevel == 3}'><fmt:message key='employee.select.level3'/></c:when><c:when test='${user.creditLevel == 4}'><fmt:message key='employee.select.level4'/></c:when><c:when test='${user.creditLevel == 5}'><fmt:message key='employee.select.level5'/></c:when><c:otherwise></c:otherwise></c:choose>">
						<c:choose>
							<c:when test="${user.creditLevel == 1}">
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">
							</c:when>
							<c:when test="${user.creditLevel == 2}">
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">
							</c:when>
							<c:when test="${user.creditLevel == 3}">
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">
							</c:when>
							<c:when test="${user.creditLevel == 4}">
								<img class="btn_img" src="./images/e_level.bmp">&nbsp;&nbsp;
								<img class="btn_img" src="./images/e_level.bmp">
							</c:when>
							<c:otherwise>-</c:otherwise>
						</c:choose>
						</td>
						<td>
							<c:choose>
								<c:when test="${user.creditLevel > 1}">
									<img class="btn_img" src="./images/a_uplevel.gif" onclick="updateEmployeeLevel(${user.id},0)" title="<fmt:message key='employee.button.up'/>">&nbsp;&nbsp;
								</c:when>
								<c:otherwise>
									<img class="btn_img2" src="./images/s_uplevel.gif" title="<fmt:message key='employee.button.up'/>">&nbsp;&nbsp;
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${user.creditLevel < 5}">
									<img class="btn_img" src="./images/a_downlevel.gif" onclick="updateEmployeeLevel(${user.id},1)" title="<fmt:message key='employee.button.down'/>">
								</c:when>
								<c:otherwise>
									<img class="btn_img2" src="./images/s_downlevel.gif" title="<fmt:message key='employee.button.down'/>">
								</c:otherwise>
							</c:choose>
						</td>
					</tr>
					<%i++; %>
					</c:if>
					</c:forEach>
					<%
						if(i == 0){
					%>
					<tr><td colspan="7" align="center">请选择左边组织架构进行查看！</td></tr>
					<%		
						}
					%>
				</table>
			</td>
		</tr>
	</table>
	<input id="deptId" name="deptId" type="hidden" value="${deptId}"/>
</form>
</body>
</html>